import { ref, reactive, computed, Component } from 'vue';
import FileBasicInfo from './components/FileBasicInfo.vue';
import FileProperty from './components/FileProperty.vue';
import FileAttachment from './components/FileAttachment.vue';
import FileApproveInfo from './components/FileApproveInfo.vue';
import FileHistoryApproveInfo from './components/FileHistoryApproveInfo.vue';
import FileTraingInfo from './components/FileTraingInfo.vue';

type StepsItemsType = {
    title: string | undefined;
    description?: string | undefined,
    component?: Component | null,
    data?: string | undefined;

}
// 详情数据
export const detailData: any = reactive({
    basicInfo: {
        fileNo: 'LSTC-QMS-QA-P-004', // 文件编号
        fileVersion: '1.2', // 文件版本
        fileStatus: '待审批', // 文件状态
        fileAttributes: '体系文件', // 文件属性
        fileCategory: '程序文件', // 文件类别
        fileName: '来料部件质量管理程序 ', // 文件名称
        sendTO: 'LSTC CQE;LSTC MFG;LSTC MM;LSTC PQE', // 发送至
        createUser: 'tianyl5/田雨龙', // 创建人
        filesOwner: 'tianyl5/田雨龙', // 文件所属人
        approver: 'zhangag/Aiguo Zhang', // 批准人
        IsOccupied: '未占用', // 是否被占用
    },
    property: {
        productRange: 'All/通用', //产品范围
        issuingDepartment: 'QA/质量部', //发文部门
        filesChangeLog: '文件版本升级，增加IQC检验', // 文件更改记录
        standardTerms: '4.4/质量管理体系及其过程', // 标准条款
        favNameTwo: 'QMS/质量管理体系', // 适用体系
        applyFactory: 'LSTC/联想系统集成（深圳）有限公司-LSTC(ISG）', // 适用工厂
        receiptRange: ['LSTC Server MFG', 'LSTC CQE', 'LSTC MM'], // 发文范围
        emailGroup: ['LSTC MFG(LSTC MFG)', 'LSTC CQE(LSTC CQE)', 'LSTC PQE(LSTC PQE)', 'LSTC MIM(LSTC MM)'], // 发送群组
    },
    attachment: {
        info: {},
        list: []
    },
    // 审批信息
    approveInfo: {
        info: {
            workflowName: 'STEP3', //工作流名称
            approveType: '升级文件', //审批类型
        },
        list: [
            {approveLevel:'1', approveName: '预审', approveStatus:'审批通过', approveStartTime: '2024-04-12 09:33:51', approveDate: '2024-04-17 10:15:42', approveUser: 'yangxf5/杨秀芳' }
        ]
    },
    // 历史审批信息
    historyApproveInfo: {
        info: {},
        list: []
    },
    // 培训信息
    traingInfo: {
        info: {},
        list: []
    }
});

// 当前步骤条值
export const stepsCurrentValue = ref(0);
// 详情步骤条配置
export const stepsItems = ref<StepsItemsType[]>([
    {
        title: '文件基本信息',
        description: ' ',
        component: FileBasicInfo,
        data: 'basicInfo',
    },
    {
        title: '文件属性信息',
        description: ' ',
        component: FileProperty,
        data: 'property',
    },
    {
        title: '附件信息',
        description: ' ',
        component: FileAttachment,
        data: 'attachment',
    },
    {
        title: '审批信息',
        description: ' ',
        component: FileApproveInfo,
        data: 'approveInfo',
    },
    {
        title: '历史审批信息',
        description: ' ',
        component: FileHistoryApproveInfo,
        data: 'historyApproveInfo',
    },
    {
        title: '培训信息',
        description: ' ',
        component: FileTraingInfo,
        data: 'traingInfo',
    },
]);

// 当前步骤条项
export const currentStepItem = computed(() => {
    return stepsItems.value[stepsCurrentValue.value];
});

